package com.sgj.dao;

import com.sgj.pojo.Type;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @author 沈国纪
 * @date 2021/3/30 17:16
 */
public interface TypeRepository extends JpaRepository<Type, Long> {

	/**
	 * 根据姓名查找分类
	 * @param name
	 * @return
	 */
	Type findByName(String name);

	/**
	 * 根据分页条件查询分类
	 * @param pageable
	 * @return
	 */
	@Query("select t from Type t")
	List<Type> findTop(Pageable pageable);
}
